package com.wcpdoc.exam.core.em;

import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.annotation.JSONType;

/**
 * @Classname EmCpState
 * @Description TODO
 * @Version 1.0.0
 * @Date 2023/2/9 14:52
 * @Created by CALVIN
 */
@JSONType(serializeEnumAsJavaBean = true)
public enum EmResourceType {
    文件夹(1,"文件夹"),
    图片(2,"图片"),
    文档(3,"文档"),
    视频(4,"视频"),
    音频(5,"音频"),
    其他(6,"其他");

    EmResourceType(Integer code, String name){
        this.id=code;
        this.name=name;
    }
    private Integer id;
    private String name;
    public Integer getCode() {
        return id;
    }
    public String getName() {
        return name;
    }



    public static EmResourceType getEm(Integer value) {
        EmResourceType[] enums = values();
        for (EmResourceType em : enums) {
            if (em.getCode().equals(value)) {
                return em;
            }
        }
        return null;
    }

    public static String getName(Integer value) {
        EmResourceType em = getEm(value);
        if(em!=null){
            return em.getName();
        }
        return StrUtil.EMPTY;
    }
}
